import request from '@/utils/request'

export function login(username, password,isAdmin) {
  if(isAdmin)
    return request({
      url: '/user/adminlogin',
      method: 'post',
      data: {
        userName:username,
        password
      }
    })
  else
  return request({
    url: '/user/login',
    method: 'post',
    data: {
      userName:username,
      password
    }
  })
}

export function getInfo(token) {
  return request({
    url: '/user/info',
    method: 'get',
    params: { token }
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}
